<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin-top: 20px;
      }
      .demo1 {
        background-color: aqua;
        height: 50px;
      }
      .box1 {
        padding: 5px;
        background-color: blue;
      }
      .box2 {
        padding: 5px;
        background-color: yellow;
      }
      .list {
        width: 200px;
        height: 200px;
        background-color: peru;
        overflow: auto;
      }
      li {
        height: 100px;
      }
    </style>
    <!-- 以借助 script 标签直接通过 CDN 来使用 Vue： -->
    <script src="./JS/vue.global.js"></script>
  </head>
  <body>
    <!-- 
    Vue中的事件修饰符：
       1.prevent：阻止默认事件
       2.stop：阻止事件冒泡
       3.once：事件只触发一次
       4.capture：使用事件的捕获模式
       5.self：只有event。target是当前操作的元素时才触发事件
       6.passive：事件的默认行为是立即执行，无需等待事件回调执行完毕
    -->
    <div id="app">
      <h2>Hello, {{ message}}</h2>
      <a href="./1-搭建vue.html " @click.prevent="showInfo"> 提示信息</a>
      <div class="demo1" @click="showInfo">
        <button @click.stop="showInfo">提示信息</button>
      </div>
      <button @click.once="showInfo">提示信息</button>
      <div class="box1" @click="showMsg(1)">
        div1
        <div class="box2" @click="showMsg(2)">div2</div>
      </div>
      <div class="demo1" @click.self="showInfo">
        <button @click.stop="showInfo">提示信息</button>
      </div>
      <ul @wheel.passive="demo" class="list">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
      </ul>
    </div>

    <script>
      Vue.createApp({
        data() {
          return {
            message: "wrod",
          };
        },
        methods: {
          showInfo(e) {
            alert("你好");
          },
          showMsg(msg) {
            console.log(msg);
          },
          demo() {
            console.log("@");
          },
        },
      }).mount("#app");
    </script>
  </body>
</html>
